home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-11 | 1.5 KB | 30 lines | [TEXT/KAHL] |
- ThreadLib implements nonpreemptive multiple thread execution within
- a single application. It does not require any extensions, should work
- with all Macintosh models (from the Plus on up), and works with
- systems 6.0 (tested on 6.0.5) under Finder or MultiFinder, and
- system 7.0. ThreadLib compiles into a small library of about 4.5K,
- so it won't add much overhead to your application. A small test
- application and THINK C project demonstrates how threads are used.
- Best of all, the source code, entirely in C, is free.
-
- Every thread has its own stack and exception handling environment;
- all other global application data is shared by the threads. Context
- switches are very efficient since they involve only a few operations
- to save the current thread's state, followed by a longjmp to the new
- thread and restoration of the new thread's exception environment. There
- are also no restrictions on the objects that can be allocated on a
- thread's stack.
-
- The rest of this file [ThreadLib.c] is heavily commented, so you should
- be able to follow how threads are implemented. Each external function has
- a description of its parameters and what it does.
-
- Also included is an exception handling library. Exceptions are handled
- using the standard C routines setjmp and longjmp, and so this library
- should be easy to port to a native PowerPC implementation. Comments
- in ExceptionLib.c explain how to use the exceptions.
-
- ThreadLib was written using THINK C 5.0.4. Some minor changes may be
- needed to port it to MPW C. All suggestions and enhancements are
- welcome.
-